//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package org.ares.app.demo.daos;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

@Component
public class AuthService {
    String[] adv = new String[]{"GetTrafficLightNowStatus", "SetTrafficLightNowStatus", "GetTrafficLightConfigAction", "SetTrafficLightConfig", "GetRoadLightStatus", "SetRoadLightStatusAction", "SetRoadLightControlMode", "SetLightSenseValve", "GetAllCarPeccancy", "GetCarInfo", "GetSUserInfo"};
    String[] nor = new String[]{"GetCarSpeed", "SetCarMove", "GetCarAccountBalance", "SetCarAccountRecharge", "GetCarRechargeRecord", "GetAllSense", "GetSenseByName", "GetLightSenseValve", "GetBusStationInfo", "GetBusCapacity", "GetRoadStatus", "GetPeccancyType", "GetCarPeccancy", "GetWeather", "SetLightSenseValve", "user_login"};
    String[] adv_v2 = new String[]{"set_car_move", "get_all_sense", "get_roadlight_status", "set_roadlight_status", "get_roadlight_control_mode", "set_roadlight_control_mode", "get_trafficlight_config", "set_trafficlight_config", "get_trafficlight_now_status", "set_trafficlight_now_status", "get_all_car_peccancy", "get_car_peccancy", "set_car_account_recharge", "get_car_account_balance", "get_car_move", "get_sense_by_name", "get_bus_capacity", "get_road_status", "get_bus_station_info", "get_car_info", "get_peccancy_type", "user_login", "get_all_user_info", "get_weather", "set_etc_rate", "get_etc_rate", "get_etc_traffic_log", "get_etc_blacklist", "set_etc_blacklist", "get_car_account_record", "get_car_account_fee", "set_car_account_fee", "get_travel_info", "set_travel_order", "get_travel_order", "get_news_info", "get_notice", "set_suggestion", "get_all_suggestion", "feedback", "commit_order", "set_rate", "get_metro", "get_customized_bus", "order_item", "get_car_history", "get_park", "get_travel_all_info", "set_busline_order", "get_busline_order", "get_busline_info", "set_light_sense_value", "get_light_sense_value", "get_etc_notice"};
    String[] nor_v2 = new String[]{"set_car_move", "set_etc_rate", "get_weather", "user_login", "get_peccancy_type", "get_busstation_info", "get_road_status", "get_bus_capacity", "get_sense_by_name", "get_all_sense", "get_car_peccancy", "set_car_account_recharge", "get_car_account_balance", "get_car_move", "get_etc_rate", "get_etc_blacklist", "set_etc_blacklist", "get_car_account_record", "get_car_account_fee", "get_travel_info", "set_travel_order", "get_travel_order", "get_news_info", "get_notice", "set_suggestion", "get_all_suggestion", "feedback", "commit_order", "set_rate", "get_metro", "get_customized_bus", "order_item", "get_car_history", "get_park", "get_travel_all_info", "set_busline_order", "get_busline_order", "get_busline_info", "set_light_sense_value", "get_light_sense_value", "get_etc_notice"};
    List<String> role_auser = new ArrayList();
    List<String> role_nuser = new ArrayList();
    Map<String, List<String>> m_auth = new HashMap();
    static final String ROLE_ADMIN = "admin";
    static final String ROLE_AUSER = "adv_user";
    static final String ROLE_NUSER = "nor_user";

    public AuthService() {
    }

    public boolean auth(String role, String url) {
        boolean var3 = false;
        if (StringUtils.isEmpty(role)) {
            return false;
        } else if ("admin".equals(role)) {
            return true;
        } else if (this.m_auth.get(role) == null) {
            return false;
        } else {
            var3 = ((List)this.m_auth.get(role)).contains(url);
            return var3;
        }
    }

    public void init() {
        String[] var1 = this.nor;
        int var2 = var1.length;

        int var3;
        String var4;
        for(var3 = 0; var3 < var2; ++var3) {
            var4 = var1[var3];
            this.role_nuser.add(var4);
            this.role_auser.add(var4);
        }

        var1 = this.adv;
        var2 = var1.length;

        for(var3 = 0; var3 < var2; ++var3) {
            var4 = var1[var3];
            this.role_auser.add(var4);
        }

        this.m_auth.put("adv_user", this.role_auser);
        this.m_auth.put("nor_user", this.role_nuser);
    }

    @PostConstruct
    public void init_v2() {
        String[] var1 = this.nor_v2;
        int var2 = var1.length;

        int var3;
        String var4;
        for(var3 = 0; var3 < var2; ++var3) {
            var4 = var1[var3];
            this.role_nuser.add(var4);
        }

        var1 = this.adv_v2;
        var2 = var1.length;

        for(var3 = 0; var3 < var2; ++var3) {
            var4 = var1[var3];
            this.role_auser.add(var4);
        }

        this.m_auth.put("adv_user", this.role_auser);
        this.m_auth.put("nor_user", this.role_nuser);
    }
}
